L.PanTool = L.Tool.extend({

  enable: function(editor){
    L.Tool.prototype.enable.call(this, editor);
    this.name = "pan_tool";
    // Moving state
    this._moving = false;
  },
  

  onDragstartElement: function(element, event){},
  onDragmoveElement: function(element, event){},
  onDragendElement: function(element, event){},

  onDragstartCanvas: function(canvas, event){
    this._moving = true;
    var node = canvas.getSVGNode()[0];

    this._inix = parseInt(node.style.left);
    this._iniy = parseInt(node.style.top);
    this._x = event.pageX;
    this._y = event.pageY;
    this._node = node;
  },

  onDragmoveCanvas: function(canvas, event){
    if (this._moving == true) {
      var dx = (event.pageX - this._x);
      var dy = (event.pageY - this._y);
      canvas._panzoom.pan(dx, dy);
      this._x = event.pageX;
      this._y = event.pageY;
      canvas.updateBackgroundPanzoom();
    }
  },

  onDragendCanvas: function(canvas, event){
    this._moving = false;
  },

  disable: function(editor){},


});